/**
 * 
 */
package com.surelution.lansao.wxmp

import com.surelution.lansao.Order;
import com.surelution.whistle.core.Attribute;

/**
 * @author <a href="mailto:guangzong.syu@gmail.com">Guangzong</a>
 *
 */
class OrderStatusAction extends BaseLansaoAction {

	/* (non-Javadoc)
	 * @see com.surelution.whistle.core.BaseAction#accept()
	 */
	@Override
	public boolean accept() {
		return getParam(Attribute.KEY_MsgType) == "text" && getParam(Attribute.KEY_Content) == "2"
	}

	/* (non-Javadoc)
	 * @see com.surelution.whistle.core.BaseAction#execute()
	 */
	@Override
	public void execute() {
		if(member && partner) {
			def order = Order.findAllByMemberAndPartner(member, partner)
			StringBuilder sb = new StringBuilder()
			if(order) {
				sb.append("您有个未送货的订单")
			} else {
				sb.append("您没有尚未送餐的订单！")
			}
			put(new Attribute(Attribute.KEY_Content, sb.toString()))
		}
	}

}
